import { ref } from 'vue'

export function useDefaultRef<T>(init: () => T) {
  const state = ref<T>(init())

  const reset = () => (state.value = init())

  return [state, reset] as const
}
